import * as http from 'http';
import * as socketio from './socketIOServer';

import app from './app';
import logger from '../common/logger';
import { configurationService } from '../domain/service/configService';

const server = http.createServer(app);
socketio.init(server);

const port = configurationService.config.server.port;

server.listen(port, () => {
  logger.info(`gateway is listening 0.0.0.0:${port}`);
});
server.on('error', (e) => {
  logger.error(`gateway start error ${e.message}`);
  process.exit(-1);
});


